package org.gcb.core.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

/**
<p>Each character race offers the following types of
benefits.</p>
<p><b>Ability Scores:</b> Your character race gives you a
bonus to a particular ability score or two. Keep these
bonuses in mind when you assign your ability scores
(see “Ability Scores,” page 16).</p>
<p><b>Speed:</b> Your speed is the number of squares you
can normally move when you walk (see “Movement
and Position,” page 282).</p>
<p><b>Vision:</b> Most races, including humans, have normal
vision. Some races have low-light vision; they see better
in darkness than humans do (see “Vision and Light,”
page 262).</p>
<p><b>Languages:</b> You start off knowing how to speak,
read, and write a few languages. All races speak
Common, the language passed on by the last human
empire, and some races let you choose a language (see
“Languages and Scripts,” page 24).</p>
<p><b>Other Racial Traits:</b> Other traits include bonuses
to your skills, weapon training, and a handful of other
traits that give you capabilities or bonuses that
members of other races don’t have.</p>
<p><b>Racial Power:</b> Several races give you access to
a racial power, which is an extra power you gain at
1st level in addition to the powers your class gives
you. See page 54 for an explanation of how to read
a power description.</p>
 * @author Jason
 */
public class Race {

    public static final String PROP_NAME = "name";
    public static final String PROP_FLAVORTEXT = "flavorText";
    protected String name = "";
    protected String flavorText = "[None]";
    protected final Toon toon;

    /**
     * Get the value of toon
     *
     * @return the value of toon
     */
    public Toon getToon() {
	return toon;
    }

    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

    public Race(Toon toon) {
	this.toon = toon;
    }

    /**
     * Get the value of name
     *
     * @return the value of name
     */
    public String getName() {
	return name;
    }

    /**
     * Set the value of name
     *
     * @param name new value of name
     */
    public void setName(String name) {
	String oldName = this.name;
	this.name = name;
	propertyChangeSupport.firePropertyChange(PROP_NAME, oldName, name);
    }

    /**
     * Get the value of flavorText
     *
     * @return the value of flavorText
     */
    public String getFlavorText() {
	return flavorText;
    }

    /**
     * Set the value of flavorText
     *
     * @param flavorText new value of flavorText
     */
    public void setFlavorText(String flavorText) {
	String oldFlavorText = this.flavorText;
	this.flavorText = flavorText;
	propertyChangeSupport.firePropertyChange(PROP_FLAVORTEXT, oldFlavorText, flavorText);
    }

    /**
     * Add PropertyChangeListener.
     *
     * @param listener
     */
    public void addPropertyChangeListener(PropertyChangeListener listener) {
	propertyChangeSupport.addPropertyChangeListener(listener);
    }

    /**
     * Remove PropertyChangeListener.
     *
     * @param listener
     */
    public void removePropertyChangeListener(PropertyChangeListener listener) {
	propertyChangeSupport.removePropertyChangeListener(listener);
    }
}
